# encoding:utf8
from django.contrib.auth.models import User

from user.models import UserModel


def save_user(register_form):
    user = User()
    user.username = register_form.cleaned_data["username"]
    user.set_password(register_form.cleaned_data["password"])
    user.email = register_form.cleaned_data["email_address"]
    user.save()
    user_model = UserModel()
    user_model.user = user
    user_model.real_name = register_form.cleaned_data["real_name"]
    user_model.mobile_number = register_form.cleaned_data["mobile_number"]
    user_model.save()
